/*	
   ______   ______    
  /\__  __\/\ \___\ 
  \/_/\ \_/\ \ \__/    __   __     __       
     \ \ \  \ \ \__\  /\ \ /\ \  /'__`\  
     _\_\ \  \ \ \_/_ \ \ \\_\ \/\  __/       
    /\____/   \ \_____\\ \_____/\ \____\   
    \_/__/     \/_____/ \/____/  \/____/                   
 
 	This file is part of the JEVE core API.

    JEve is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    JEve is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    Copyright 2008 JEve Project (JEveProject@gmail.com)
 */
package be.fomp.jeve.core.api.connectors;

import be.fomp.jeve.core.api.LimitedAPI;
import be.fomp.jeve.core.api.url.LimitedUrl;
import be.fomp.jeve.core.config.CoreConfiguration;
import be.fomp.jeve.core.exceptions.JEveConnectionException;
import be.fomp.jeve.core.exceptions.JEveParseException;
import be.fomp.jeve.core.util.ParameterString;
import org.jdom.Document;

/**
 * <pre>
 *  ______   ______
 * /\__  __\/\ \___\
 * \/_/\ \_/\ \ \__/    __   __     __
 *    \ \ \  \ \ \__\  /\ \ /\ \  /'__`\
 *    _\_\ \  \ \ \_/_ \ \ \\_\ \/\  __/
 *   /\____/   \ \_____\\ \_____/\ \____\
 *   \_/__/     \/_____/ \/____/  \/____/
 * </pre>
 * This file is part of the JEVE core API.<br />
 * <br />
 * <p/>
 * This class contains the accessor methods for the EVE-Online API
 * which require a limited API key.
 * <p/>
 * * Default visibility: This class should only be created using the factory
 *
 * @author Sven Meys
 */
class LimitedConnector extends StandardConnector implements LimitedAPI {

	/**
	 * Constructor which takes a configuration setting. This configures the correct
	 * proxy settings to ensure the client can access the internet.
	 *
	 * @param config The configuration settings
	 */
	protected LimitedConnector(CoreConfiguration config) {
		super(config);
	}

	
	public final Document getCharacterSheet(int userID, String apiKey, int characterID) throws JEveConnectionException, JEveParseException {

		ParameterString parameters = new ParameterString();
		parameters.addParameter("userID", userID)
				.addParameter("apiKey", apiKey)
				.addParameter("characterID", characterID);

		return getDocumentData(LimitedUrl.CHARACTER_SHEET, parameters);
	}

	
	public final Document getCharacters(int userID, String apiKey) throws JEveConnectionException, JEveParseException {

		ParameterString parameters = new ParameterString();
		parameters.addParameter("userID", userID)
				.addParameter("apiKey", apiKey);

		return getDocumentData(LimitedUrl.CHARACTERS, parameters);
	}

	
	public final Document getCorporationSheet(int userID, String apiKey, int characterID) throws JEveConnectionException, JEveParseException {

		ParameterString parameters = new ParameterString();
		parameters.addParameter("userID", userID)
				.addParameter("apiKey", apiKey)
				.addParameter("characterID", characterID);

		return getDocumentData(LimitedUrl.CORPORATION_SHEET, parameters);
	}

	
	public final Document getSkillInTraining(int userID, String apiKey, int characterID) throws JEveConnectionException, JEveParseException {

		ParameterString parameters = new ParameterString();
		parameters.addParameter("userID", userID)
				.addParameter("apiKey", apiKey)
				.addParameter("characterID", characterID);

		return getDocumentData(LimitedUrl.SKILL_IN_TRAINING, parameters);
	}
}
